let v = new Vue({
    el: '#app',
    data: {
        uid:'',
        meeting:{
            id:''
        },
        deptUserCount:'',    //应到人数
        arrivedNum:'',         //已到人数
        notArrived:'',  //未到人数
        isJoin:false,   //是否有参加
    },
    methods: {
        findMeeting:function (){
            axios(`meeting/findById/${this.meeting.id}`)
                .then(rsp=>{
                    if (rsp.data.flag){
                        this.meeting = rsp.data.data.meeting;
                        this.deptUserCount = rsp.data.data.deptUserCount;
                        this.arrivedNum = rsp.data.data.arrivedNum;
                        this.notArrived = rsp.data.data.notArrived;
                        this.isJoin = rsp.data.data.isJoin;
                    }
                }).catch(error=>{
                    layer.msg(error.messages);
            })
        },
        joinMeeting:function (){
            if (this.meeting.status !== 0){
                layer.msg("该会议已不能参加");
                return false;
            }
            this.isJoin = !this.isJoin; //取反
            axios.put(`meeting/joinMeeting/${this.meeting.id}/${this.uid}/${this.isJoin}`)
                .then(rsp=>{
                    layer.msg(rsp.data.data);
                }).catch(error=>{
                    layer.msg(error.messages);
            })
        }
    },
    created: function () {
        this.meeting.id = sessionStorage.getItem("mId");
        this.uid = sessionStorage.getItem("myId");
        this.findMeeting();
    }
})